/**
 * Copyright 2013 DJSearch Co.,Ltd. All rights reserved.
 * DTM PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.police.router;

import java.util.HashMap;
import java.util.Map;

/**
 * @author dingzhongchang
 * @version 1.0.0
 */
public class DefaultRouter implements IRouter {
    private static String DefaultMethodPath = IRouter.IP + "/mobile_service/";
    private Map<String, String> cache = new HashMap<String, String>();

    /**
     * 构造Router
     */
    public DefaultRouter() {
        init();
    }

    private void init() {
        //账户登录(只有管理账户修改密码需要调用服务器此接口)
        // http://218.28.168.5:9090/mobile_service/user.jsp?act=login&userid=设备号&userpwd=密码
        //http://218.28.168.5:9090/mobile_service/user.jsp?act=login&userid=abc-12345678-00003&userpwd=2342
        cache.put("login", DefaultMethodPath + "user.jsp?act=login");
        //账户修改密码(只有管理账户修改密码需要调用服务器此接口)
        //http://218.28.168.5:9090/mobile_service/user.jsp?act=edit&userid=设备号&userpwd=新密码
        cache.put("edit", DefaultMethodPath + "user.jsp?act=edit");
        //基站搜索
        //http://218.28.168.5:9090/mobile_service/basestation.jsp?act=qryPoint&lac=基站号&cid=小区号
        cache.put("qryPoint", DefaultMethodPath + "basestation.jsp?act=qryPoint");

        //基站列表
        //http://218.28.168.5:9090/mobile_service/basestation.jsp?act=qryCell&lon=经度&lat=纬度
        cache.put("qryCell", DefaultMethodPath + "basestation.jsp?act=qryCell");

        //位置上报
        //http://218.28.168.5:9090/mobile_service/location.jsp?act=addLoc&deviceid=设备号&gpstime=GPS时间&lon=经度&lat=纬度
        cache.put("addLoc", DefaultMethodPath + "location.jsp?act=addLoc");

        //位置历史查询
        //http://218.28.168.5:9090/mobile_service/location.jsp?act=qryLoc&deviceid=设备号&bt=开始时间&et=结束时间
        cache.put("qryLoc", DefaultMethodPath + "location.jsp?act=qryLoc");

        //基站扇区搜索
        //http://218.28.168.5:9090/mobile_service/basestation.jsp?act=qryCellByCell&lac=基站号&cid=小区号
        cache.put("qryCellByCell", DefaultMethodPath + "basestation.jsp?act=qryCellByCell");
        
        cache.put("newVersion", DefaultMethodPath + "apk.jsp?");
        
        cache.put("imei", DefaultMethodPath + "user.jsp?act=checkServiceState");
    }


    @Override
    public String getMethodPath(String method) {
        if (cache.containsKey(method)) {
            return cache.get(method);
        }
        return DefaultMethodPath;
    }

}
